package network

import (
	"net/http"
	"time"
)

var (
	// maxHeaderBytes is used by the http logic to limit the size of request headers.
	// This may need to be increased if accepting cookies from the public.
	maxHeaderBytes = 1 << 20
	// readTimeout is used by the http logic to set a maximum duration before
	// timing out read of the request. The default timeout is 10 seconds.
	readTimeout = 60 * time.Second
	// writeTimeout is used by the http logic to set a maximum duration before
	// timing out write of the response. The default timeout is 10 seconds.
	writeTimeout = 60 * time.Second
)

func HttpServer(handler http.Handler) *http.Server {
	return &http.Server{
		Handler:        handler,
		MaxHeaderBytes: maxHeaderBytes,
		ReadTimeout:    readTimeout,
		WriteTimeout:   writeTimeout,
	}
}
